package io.iec.edp.caf.session.mock;

import io.iec.edp.caf.core.session.CafSession;
import io.iec.edp.caf.core.session.ICafSessionService;

/**
 * 模拟ICafSessionService使用场景
 *
 * @author manwenxing01
 */
public class MyService {

    private ICafSessionService service;

    public void findAndExpireAndDelete(String id) {
        //find session
        CafSession session = this.service.findById(id);
        //use session
        session.getUserId();

        //delete session if session is expired
        boolean expired = this.service.isExpired(id);
        if (expired) {
            this.service.deleteById(id);
        }
    }

}
